//
//  RHLocalSettingModel.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/4/9.
//

#import "RHLocalSettingModel.h"
#import "RHLocalSettingOptionModel.h"

@implementation RHLocalSettingModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
     return @{
                @"selectList" : [RHLocalSettingOptionModel class],
               @"properList" : [RHLocalSettingModel class]
     };
 }


- (void)setData:(NSDictionary *)data{
    _data = data;
    if(_data == nil)return;
    NSMutableArray *array = [NSMutableArray array];
    for (NSString *key in self.keys) {
        NSDictionary *dic = _data[key];
        RHLocalSettingModel *model = [RHLocalSettingModel yy_modelWithDictionary:dic];
        model.field = key;
        [array addObject:model];
    }
    self.dataList = array;
    _data = nil;
}


- (void)setProperties:(id)properties{
    _properties = properties;
    if ([_properties isKindOfClass:[NSString class]] || _properties==nil) {
        return;
    }
    NSDictionary *properties_dic = (NSDictionary *)_properties;
    NSMutableArray *array = [NSMutableArray array];
    //NSLog(@"self.keys ==== %@",[self.keys debugDescription]);
    for (NSString *key in self.keys) {
        NSDictionary *dic = properties_dic[key];
        RHLocalSettingModel *model = [RHLocalSettingModel yy_modelWithDictionary:dic];
        model.field = key;
        if(model == nil){
            NSLog(@"---->key:%@",key);
        }
        [array addObject:model];
    }
    self.properList = array;
    _properties = nil;
}




@end
